﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

public partial class reg : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }
    protected void submitb_ServerClick(object sender, EventArgs e)
    {
        string userID = login_name.Value;
        string pass1 = userword.Value;
        string pass2 = userword2.Value;
        string email = e_mail.Value;
        string mobile = tbmobile.Value;

        BHBC.Entity.TbUserAccountInfo uci = new BHBC.Entity.TbUserAccountInfo();
        uci.UserID = userID;
        //uci.Passwd = ZFrameWork.Util.MD5.ComputeHash( pass1);
        uci.Passwd = CommFuncLib.GetMD5Hash(pass1);
        uci.Mobile = mobile;
        uci.Email = email;

        if (pass1.Trim() != pass2.Trim())
        {
            ClientScript.RegisterClientScriptBlock(this.GetType(), "", "alert('两次输入的密码不匹配,请重新输入！')", true);
            return;
        }

        uci.Passwd = CommFuncLib.GetMD5Hash(pass1);

        if (BHBC.BC.User.UserReg.CheckUserExist(uci.UserID) == 1)
        {
            ClientScript.RegisterClientScriptBlock(this.GetType(), "", "alert('已存在相同的用户,请更改一个用户名后重新注册！')",true);
            return;
        }

        int tag = BHBC.BC.User.UserReg.CommUserRegister(uci);
        if (tag == 1)
        {
            SessionManage.User = 
            // 转到门户页
            Response.Redirect("Home.aspx");
        }
        else
        {
            ClientScript.RegisterClientScriptBlock(this.GetType(), "", "alert('注册失败,请检查您提交的信息是否正确！')");
        }
    }
}
